<template>
    <div>
        <div v-for="item in list" :key="item.id" style="display: inline-block"><input type="checkbox" :value="item" v-model="choose" />{{ item }}</div>
        <p>你选中的元素和为{{ all }}</p>
    </div>
</template>

<script>
export default {
    data() {
        return {
            list: [9, 15, 19, 25, 29, 31, 48, 57, 62, 79, 87],
            choose: [],
        }
    },
    computed: {
        all() {
            return this.choose.reduce((sum, i) => sum + i, 0)
        },
    },
}
</script>

<style>
.box {
    display: flex;
}
</style>
